Repository navigation
pip: recognize requirements layers from nested graph scans - #16972
Draft
Ahmed3lmallah wants to merge 1 commit into
Draft
Ahmed3lmallah wants to merge 1 commit into
Ahmed3lmallah wants to merge 1 commit into
Conversation
Keep requirements classification consistent across root and nested scans without changing ordinary pip update discovery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The helper rename leaves 21 examples raising NoMethodError, while a misplaced multi-layer expectation also causes the single-layer spec context to fail.
2 open issues
What changed in this PR
This PR makes pip dependency graphing recognize requirements layers by repository path, so nested scans retain files such as /requirements/base.txt. Ordinary update discovery and snapshot identities remain unchanged.
Changes:
- Use repository paths consistently for requirements filtering, layer grouping, and single-manifest selection.
- Add regression examples for root and nested scans,
-rreferences, and single-layer scopes.
| File | Description |
|---|---|
python/spec/dependabot/python/dependency_grapher_spec.rb |
Adds nested-scan and requirements-layer regression examples. |
python/lib/dependabot/python/dependency_grapher/requirements_layers.rb |
Classifies requirements files using their repository paths. |
python/lib/dependabot/python/dependency_grapher.rb |
Applies the classifier to filtering and single-manifest selection. |
Review effort: Balanced
| def self.manifest_txt_filename?(path) | ||
| # Use the repository path so `requirements/base.txt` is classified the same from either scan directory. | ||
| sig { params(file: Dependabot::DependencyFile).returns(T::Boolean) } | ||
| def self.manifest_txt_file?(file) |
| end | ||
| end | ||
|
|
||
| include_examples "graphs the same requirements files" |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What are you trying to accomplish?
A pip graph job scoped to
/requirementsseesbase.txtrather thanrequirements/base.txtand can drop it. Classify requirements by repository path in filtering, layer grouping, and single-manifest selection.Anything you want to highlight for special attention from reviewers?
This only changes pip graphing. Ordinary update file discovery and snapshot identities are unchanged. Scheduling a refresh for overlapping parent snapshots is separate.
How will you know you've accomplished your goal?
New regression examples cover root and child scopes,
-rreferences, and a single-file child scope.ruby -con the changed Ruby files andgit diff --checkpassed. A focused local harness using the actual requirements parser reproduced the empty child output on main and passed for root, child, and single-file cases with this patch. Full RSpec and end-to-end graph validation are pending.Checklist